package com.aigc.sclassroom.mapper;

import com.aigc.sclassroom.pojo.SignRecord;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SignRecordMapper{
    @Select("SELECT * FROM sign_record WHERE sign_id = #{signId}")
    List<SignRecord> selectBySignId(@Param("signId") Long signId);

    @Select("SELECT COUNT(*) FROM sign_record WHERE sign_id = #{signId} AND user_id = #{userId}")
    Integer checkSigned(@Param("signId") Long signId, @Param("userId") Long userId);

    @Insert("INSERT INTO sign_record (sign_id, user_id, status,sign_time) VALUES (#{signId}, #{userId}, #{status},#{signTime})")
    void insertRecod(SignRecord record);

}